<html>
<head><title>Server Info</title></head>
<?php
/*
whmtools - easily find accounts on cpanels servers
Copyright (C) 2006  Matthew Davis <matthew@familycampground.org>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

require 'Accounting.php.inc';
include 'config.php';

mysql_select_db ("whmtools");
$netQuery = mysql_query("SELECT DISTINCT network FROM servers ORDER BY network");
print "<table border = 1><tr>\n";
while ($networks = mysql_fetch_row($netQuery)) {
    print "\t<tr valign=top><center><h2>" . $networks[0] . "</h2></center>\n";
    $query = mysql_query("SELECT * from servers WHERE network = '$networks[0]' ORDER BY hostname");
    print "<table border=1>\n\t<th>Server Name</th><th>Server Status</th>\n";
    while ($servers = mysql_fetch_row($query)) {
	print "\t<tr><td><a href=listaccts.php?server=$servers[0]>" . $servers[0] . "</a></td>";
	$serverinfo = servinfo($servers[1],$servers[2],$servers[3],0);
	print "<td>$serverinfo</td></tr>\n";
    }
    print "\t</table>\n\t</tr>\n";
}
print "</table>\n";
mysql_close($dbh);
?>
</html>
